HTMLify

index.html
Views: 81 | Author: cody
<!DOCTYPE html>
<html>
  <head>
    <meta charset="utf-8" />
    <meta http-equiv="X-UA-Compatible" content="IE=edge" />
    <title>Cool Image Carousel</title>
    <meta name="viewport" content="width=device-width, initial-scale=1" />

    <link
      rel="stylesheet"
      href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.2/css/all.min.css"
    />
    <link rel="stylesheet" type="text/css" media="screen" href="style.css" />
  </head>

  <body>
    <main>
      <ul class="slider">
        <li
          class="item"
          style="
            background-image: url('https://images.unsplash.com/photo-1598624211345-d321dda059b2?w=800&auto=format&fit=crop&q=60&ixlib=rb-4.0.3&ixid=M3wxMjA3fDB8MHxzZWFyY2h8MTV8fGNhcnMlMjB3YWxscGFwZXJzfGVufDB8MHwwfHx8MA%3D%3D');
          "
        >
          <div class="content">
            <h2 class="title">"Lorem Ipsum"</h2>
            <p class="description">
              Lorem ipsum, dolor sit amet consectetur adipisicing elit. Tempore
              fuga voluptatum, iure corporis inventore praesentium nisi. Id
              laboriosam ipsam enim.
            </p>
            <button>Read More</button>
          </div>
        </li>

        <li
          class="item"
          style="
            background-image: url('https://images.unsplash.com/photo-1621718229986-ded7d999e908?w=800&auto=format&fit=crop&q=60&ixlib=rb-4.0.3&ixid=M3wxMjA3fDB8MHxzZWFyY2h8MTIzfHxjYXJzJTIwd2FsbHBhcGVyc3xlbnwwfDB8MHx8fDA%3D');
          "
        >
          <div class="content">
            <h2 class="title">"Lorem Ipsum"</h2>
            <p class="description">
              Lorem ipsum, dolor sit amet consectetur adipisicing elit. Tempore
              fuga voluptatum, iure corporis inventore praesentium nisi. Id
              laboriosam ipsam enim.
            </p>
            <button>Read More</button>
          </div>
        </li>

        <li
          class="item"
          style="
            background-image: url('https://images.unsplash.com/photo-1538690931238-dcc3b4263c2e?w=800&auto=format&fit=crop&q=60&ixlib=rb-4.0.3&ixid=M3wxMjA3fDB8MHxzZWFyY2h8NDZ8fGNhcnMlMjB3YWxscGFwZXJzfGVufDB8MHwwfHx8MA%3D%3D');
          "
        >
          <div class="content">
            <h2 class="title">"Lorem Ipsum"</h2>
            <p class="description">
              Lorem ipsum, dolor sit amet consectetur adipisicing elit. Tempore
              fuga voluptatum, iure corporis inventore praesentium nisi. Id
              laboriosam ipsam enim.
            </p>
            <button>Read More</button>
          </div>
        </li>

        <li
          class="item"
          style="
            background-image: url('https://images.unsplash.com/photo-1570506020466-17c74d2f4590?w=800&auto=format&fit=crop&q=60&ixlib=rb-4.0.3&ixid=M3wxMjA3fDB8MHxzZWFyY2h8MTE4fHxjYXJzJTIwd2FsbHBhcGVyc3xlbnwwfDB8MHx8fDA%3D');
          "
        >
          <div class="content">
            <h2 class="title">"Lorem Ipsum"</h2>
            <p class="description">
              Lorem ipsum, dolor sit amet consectetur adipisicing elit. Tempore
              fuga voluptatum, iure corporis inventore praesentium nisi. Id
              laboriosam ipsam enim.
            </p>
            <button>Read More</button>
          </div>
        </li>

        <li
          class="item"
          style="
            background-image: url('https://images.unsplash.com/photo-1535382651921-5e77ea4458f2?w=800&auto=format&fit=crop&q=60&ixlib=rb-4.0.3&ixid=M3wxMjA3fDB8MHxzZWFyY2h8MjJ8fGNhcnMlMjB3YWxscGFwZXJzfGVufDB8MHwwfHx8MA%3D%3D');
          "
        >
          <div class="content">
            <h2 class="title">"Lorem Ipsum"</h2>
            <p class="description">
              Lorem ipsum, dolor sit amet consectetur adipisicing elit. Tempore
              fuga voluptatum, iure corporis inventore praesentium nisi. Id
              laboriosam ipsam enim.
            </p>
            <button>Read More</button>
          </div>
        </li>

        <li
          class="item"
          style="
            background-image: url('https://images.unsplash.com/photo-1631419162960-d90d86d481ea?q=80&w=2940&auto=format&fit=crop&ixlib=rb-4.0.3&ixid=M3wxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8fA%3D%3D');
          "
        >
          <div class="content">
            <h2 class="title">"Lorem Ipsum"</h2>
            <p class="description">
              Lorem ipsum, dolor sit amet consectetur adipisicing elit. Tempore
              fuga voluptatum, iure corporis inventore praesentium nisi. Id
              laboriosam ipsam enim.
            </p>
            <button>Read More</button>
          </div>
        </li>
      </ul>

      <nav class="nav">
        <ion-icon class="btn prev" name="arrow-back-outline"></ion-icon>
        <ion-icon class="btn next" name="arrow-forward-outline"></ion-icon>
      </nav>
    </main>

    <script
      type="module"
      src="https://unpkg.com/ionicons@7.1.0/dist/ionicons/ionicons.esm.js"
    ></script>

    <script
      nomodule
      src="https://unpkg.com/ionicons@7.1.0/dist/ionicons/ionicons.js"
    ></script>

    <script>
      const slider = document.querySelector(".slider");

      function activate(e) {
        const items = document.querySelectorAll(".item");
        e.target.matches(".next") && slider.append(items[0]);
        e.target.matches(".prev") && slider.prepend(items[items.length - 1]);
      }

      document.addEventListener("click", activate, false);
    </script>
  </body>
</html>

Comments